/*
package com.simulate2.demo.quartz;

import com.simulate2.demo.entity.User;
import com.simulate2.demo.service.OrderService;
import com.simulate2.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component
@EnableScheduling
public class Task {
    @Autowired
    private UserService userService;
    @Autowired
    private OrderService orderService;

    int date=20200100;
    //@Scheduled(cron="0/3 * * * * ?")
    @Scheduled(fixedDelay = 30000)
    public void task1() {
        date=date+1;
        Date date1 = new Date();                    //获得当前时间
        System.out.println("开始时间："+date1);
        System.out.println("每30秒，新增3个用户和3个订单并进入下一天："+date);
        userService.produceUser(3,date);
        orderService.produceOrder(3,date);
        orderService.caluOrdersByDay(date);

        Date date2 = new Date();                    //获得当前时间
        System.out.println("结束时间："+date2+"  共耗时："+(date2.getTime()-date1.getTime()));
    }
}
*/
